import request from '@/utils/request'

// 查询合同列表
export function listAgreement(query) {
  return request({
    url: '/AgreementMain/agreement/list',
    method: 'get',
    params: query
  })
}

export function listbyreport(query) {
  return request({
    url: '/AgreementMain/agreement/listbyreport',
    method: 'get',
    params: query
  })
}

export function listbyBB(query) {
  return request({
    url: '/AgreementMain/agreement/listbyBB',
    method: 'get',
    params: query
  })
}

export function listbySum(query) {
  return request({
    url: '/AgreementMain/agreement/listbySum',
    method: 'get',
    params: query
  })
}

// 用户状态修改
export function changeHtStatus(agrId, agrType) {
  const data = {
    agrId,
    agrType
  }
  return request({
    url: '/AgreementMain/agreement/changeStatus',
    method: 'put',
    data: data
  })
}

export function listoutAgreement(query) {
  return request({
    url: '/AgreementMain/agreement/listout',
    method: 'get',
    params: query
  })
}

export function listallAgreement(query) {
  return request({
    url: '/AgreementMain/agreement/listallout',
    method: 'get',
    params: query
  })
}

// 查询合同列表-金额合计
export function listAgreementsum(query) {
  return request({
    url: '/AgreementMain/agreement/listsum',
    method: 'get',
    params: query
  })
}


// 查询合同列表-金额合计
export function listsumfd(query) {
  return request({
    url: '/AgreementMain/agreement/listsumfd',
    method: 'get',
    params: query
  })
}
// 查询合同列表-自拓排行
export function listztph(query) {
  return request({
    url: '/AgreementMain/agreement/listztph',
    method: 'get',
    params: query
  })
}
// 查询合同列表-拨款排行
export function listbkph(query) {
  return request({
    url: '/AgreementMain/agreement/listbkph',
    method: 'get',
    params: query
  })
}

// 查询合同详细
export function getAgreement(agrId) {
  return request({
    url: '/AgreementMain/agreement/' + agrId,
    method: 'get'
  })
}

// 查询合同详细
export function getAgreement2(agrId) {
  return request({
    url: '/AgreementMain/agreement/out/' + agrId,
    method: 'get'
  })
}
 
 

// 生成合同编号
export function Htcode(agrId) {
  return request({
    url: '/AgreementMain/agreement/Htcode',
    method: 'get'
  })
}
// 新增合同
export function addAgreement(data) {
    return request({
      url: '/AgreementMain/agreement',
      method: 'post',
      data: data
    })
  }

// 新增虚拟合同
export function addAgreementxn(data) {
  return request({
    url: '/AgreementMain/agreement/addxn',
    method: 'post',
    data: data
  })
}



// 修改合同
export function updateAgreement(data) {
  return request({
    url: '/AgreementMain/agreement',
    method: 'put',
    data: data
  })
}
// 修改合同A，更新合同的ce
export function updateAgreementA(data) {
  return request({
    url: '/AgreementMain/agreement/editA',
    method: 'put',
    data: data
  })
}

// 修改合同,更新未关联合同的ce为0
export function updateAgreementCe(data) {
  return request({
    url: '/AgreementMain/agreement/editCe',
    method: 'put',
    data: data
  })
}

// 删除合同
export function delAgreement(agrId) {
  return request({
    url: '/AgreementMain/agreement/' + agrId,
    method: 'delete'
  })
}
